package com.v1.web.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.v1.lo.ItemLO;
import com.v1.model.Item;
import com.v1.util.Toolkit;

public class TagAction extends DefaultAction {

	public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String tag = getString(request, "tag");
		String decode = Toolkit.decodeZH(tag);
		ItemLO lo = (ItemLO) getBean("ItemLO");
		List<Item> items = lo.getSameTagItemByTag(decode);
		setAttribute(request, "items", items);
		setAttribute(request, "tag", decode);
		return mapping.findForward("tag");
	}

}
